<html>
<head><meta charset="utf-8"><title>Error enum generation · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Error.20enum.20generation.html">Error enum generation</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="173876740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Error%20enum%20generation/near/173876740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Error.20enum.20generation.html#173876740">(Aug 22 2019 at 12:18)</a>:</h4>
<p>Could we provide a code action to do this automatically?!</p>



<a name="173876907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Error%20enum%20generation/near/173876907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Error.20enum.20generation.html#173876907">(Aug 22 2019 at 12:20)</a>:</h4>
<p>Do what exactly?</p>



<a name="173877054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Error%20enum%20generation/near/173877054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Error.20enum.20generation.html#173877054">(Aug 22 2019 at 12:22)</a>:</h4>
<p>Sorry - can't explain ATM - a situation has arisen. I'll try and explain later</p>



<a name="173920439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Error%20enum%20generation/near/173920439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Error.20enum.20generation.html#173920439">(Aug 22 2019 at 20:58)</a>:</h4>
<p>So for example, if you have a function which uses Io::error and whatever other kind of errors, we could generate an enum for all the error cases with the right Into boilerplate.</p>



<a name="173947899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Error%20enum%20generation/near/173947899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Error.20enum.20generation.html#173947899">(Aug 23 2019 at 07:16)</a>:</h4>
<p>THat seeems like it would misfire more often than not. I wonder if this can be split into components? For example, an intention to add <code>From&lt;Foo&gt; for E</code> for <code>enum E { Foo(Foo) }</code> would be nice...</p>



<a name="173952096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Error%20enum%20generation/near/173952096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Error.20enum.20generation.html#173952096">(Aug 23 2019 at 08:42)</a>:</h4>
<p>It was just a passing thought I thought I should write down!</p>



<a name="173963926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Error%20enum%20generation/near/173963926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Error.20enum.20generation.html#173963926">(Aug 23 2019 at 12:17)</a>:</h4>
<p>It was just a passing thought I thought I should write down!</p>



<a name="173963979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Error%20enum%20generation/near/173963979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Error.20enum.20generation.html#173963979">(Aug 23 2019 at 12:18)</a>:</h4>
<p>Possibly we could support adding new variants</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>